package com.fcwy.puzzle.adapter;

import java.util.List;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

/**
 * 
 * @author lanyj
 *
 */
public class GridItemsAdapter extends BaseAdapter {

	private List<Bitmap> bitmapItemLists=null;
	private Context context;
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return bitmapItemLists.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return bitmapItemLists.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ImageView iv=new ImageView(context);		
		iv.setImageBitmap(bitmapItemLists.get(position));
		iv.setScaleType(ScaleType.FIT_XY);
		return iv;
	}
	public GridItemsAdapter(Context context,List<Bitmap> bitmapItemLists) {
		this.context=context;
		this.bitmapItemLists=bitmapItemLists;
	}
}
